package com.okami.designpatterns.single;

/**
 * @author: TanJingyu
 * @create: 2020-12-15 10:20
 **/
class Test {
    public static void main(String[] args) throws ClassNotFoundException {
        // 初始简单版,不适合多线程环境
        System.out.println(SingletonSimple.getInstance());
        System.out.println(SingletonSimple.getInstance());

        // 双重检查锁,多线程适合
        System.out.println(SingletonDoubleCheck.getInstance());
        System.out.println(SingletonDoubleCheck.getInstance());

        // 静态内部类,多线程适合
        System.out.println(SingtonStaticInnerClass.getInstance());
        System.out.println(SingtonStaticInnerClass.getInstance());
    }
}
